package com.itheima.common.exception;
import com.itheima.common.entity.ResultCode;
import com.itheima.common.enums.ExceptionEnum;
import lombok.Getter;
import lombok.Setter;

/**
 * @author IntelliJ IDEA
 * @date 2020/10/18  11:44
 *
 * 自定义异常
 */
@Getter
@Setter
public class IhrmException extends RuntimeException{
    private int status;

    private String message;

    private boolean success;

    private ResultCode resultCode;


    public IhrmException(ResultCode code){
        this.success=code.success();
        this.status=code.code();
        this.message=code.message();
    }

    public IhrmException(String message, int status) {
        super(message);
        this.status = status;
    }

    public IhrmException(String message, Throwable cause, int status) {
        super(message, cause);
        this.status = status;
    }

    public IhrmException(Throwable cause, int status) {
        super(cause);
        this.status = status;
    }


    public IhrmException(ExceptionEnum e, Throwable cause) {
        super(e.getMessage(), cause);
        this.status = e.getStatus();
    }

    public IhrmException(ExceptionEnum e) {
        super(e.getMessage());
        this.status=e.getStatus();
    }

}

